package mysql

import "gorm.io/gorm"

type Good struct {
	gorm.Model
	GoodName  string  `gorm:"type:varchar(15);not null;comment:商品名称"`
	GoodPrice float64 `gorm:"type:decimal(10,2);not null;comment:商品价格"`
	GoodStock int     `gorm:"type:int;not null;comment:商品库存"`
	GoodSell  int     `gorm:"type:int;not null;comment:商品销售量"`
	GoodState int     `gorm:"type:tinyint;not null;comment:商品审核状态:1.待审核 2.已通过"`
}

func (g *Good) GoodInfo(goodId int) error {
	return DB.Where("id = ?", goodId).First(&g).Error
}
